//============================================================
// File :     typedef.h
// Abstract:  本文件用于提供系统基本类型的定义。
// Change Logs:
// Date           Notes
// 2012-10-9     the first version
//=============================================================


#ifndef _TYPE_DEF_H_
#define _TYPE_DEF_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <stddef.h>
#include <sys/types.h>

#if defined(__CC_ARM)   // ARMCC compiler 
#define PACK_STRUCT __attribute__ ((__packed__))
#elif defined(__IAR_SYSTEMS_ICC__)   // IAR Compiler 
#define PACK_STRUCT //8λ������Ҫ
#elif defined(__GNUC__)     // GNU GCC Compiler 
#define PACK_STRUCT __attribute__((packed))
#endif


#define __I         volatile const       
#define __O         volatile      
#define __IO        volatile  

#define int32_base  int32_t       
#define int16_base  int16_t       
#define int8_base   int8_t

#define uint32_base u_int32_t
#define uint16_base u_int16_t
#define uint8_base  u_int8_t


#define ms32        int32_base        
#define ms16        int16_base        
#define ms8         int8_base         
#define mu32        uint32_base       
#define mu16        uint16_base      
#define mu8         uint8_base        

#define msc32       const int32_base     /*!< Read Only */
#define msc16       const int16_base     /*!< Read Only */
#define msc8        const int8_base       /*!< Read Only */
#define muc32       const uint32_base        /*!< Read Only */
#define muc16       const uint16_base        /*!< Read Only */
#define muc8        const uint8_base      /*!< Read Only */

#define mvs32       __IO int32_base       
#define mvs16       __IO int16_base       
#define mvs8        __IO int8_base        
#define mvu32       __IO uint32_base       
#define mvu16       __IO uint16_base      
#define mvu8        __IO uint8_base       

#define mvsc32      __I int32_base     /*!< Read Only */
#define mvsc16      __I int16_base     /*!< Read Only */
#define mvsc8       __I int8_base      /*!< Read Only */
#define mvuc32      __I uint32_base     /*!< Read Only */
#define mvuc16      __I uint16_base     /*!< Read Only */
#define mvuc8       __I uint8_base      /*!< Read Only */


#define MTRUE       (1)
#define MFALSE      (0)

#define MON         (1)
#define MOFF        (0)


#define mbool      mu8
#define M_INVALID  (-1)  //无效值
#define MNULL       ((void*)(0))
typedef void (*mHookDef)(void);


#ifdef __cplusplus
}
#endif

#endif
